<?php
/**
 * Created by JetBrains PhpStorm.
 * User: FangXuanLing
 * Date: 13-11-19
 * Time: 下午6:02
 * To change this template use File | Settings | File Templates.
 */
?>

<div >
    <strong><?php echo $name ?>  |   <a href="<?php echo Yii::app()->createUrl("admin/post/add")  ?>">添加</a></strong>

    <table>
        <tr>
            <td>ID</td><td>标题</td><td>分类</td><td>作者</td><td>状态</td><td>发布时间</td><td>最后修改时间</td><td>操作</td>
        </tr>
        <?php foreach($post as $p){ ?>
            <tr>
            <td><?php echo $p->id ?></td>
            <td><?php echo $p->title ?></td>
            <td><?php echo $p->cate->category_name ?></td>
            <td>0</td>
            <td><?php
                if($p->status == 1){
                    echo "草稿";
                }
                elseif($p->status == 2){
                    echo "对外可见";
                }
                elseif($p->status == 3){
                    echo "过期";
                }
                elseif($p->status ==4){
                    echo "已删除";
                }
                ?>
            </td>
            <td><?php echo date("Y-m-d",$p->ctime) ?></td>
            <td><?php echo date("Y-m-d",$p->utime) ?></td>
            <td><a href="<?php echo Yii::app()->createUrl("admin/post/edit",array('id'=>$p->id))  ?>">编辑</a>
                |<a href="<?php echo Yii::app()->createUrl("admin/post/del",array('id'=>$p->id))  ?>">删除</a></a></td>
            </tr>
        <?php } ?>
    </table
</div>
<div id="pager">
    <?php

    $this->widget('CLinkPager',array(
            'header'=>'',
            'firstPageLabel' => '首页',
            'lastPageLabel' => '末页',
            'prevPageLabel' => '上一页',
            'nextPageLabel' => '下一页',
            'pages' => $pages,
            'maxButtonCount'=>13
        )
    );
    ?>
</div>